package com.zggao.service.combine.impl;

import com.zggao.entity.bo.HeadLine;
import com.zggao.entity.bo.ShopCategory;
import com.zggao.entity.dto.MainPageInfoDTO;
import com.zggao.entity.dto.Result;
import com.zggao.service.combine.IHeadLineShopCategoryCombineService;
import com.zggao.service.solo.IHeadLineService;
import com.zggao.service.solo.IShopCategoryService;
import org.simpleframework.core.annotation.Service;
import org.simpleframework.inject.annotation.Autowired;

import java.util.List;

@Service
public class HeadLineShopCategoryCombineServiceImpl2 implements IHeadLineShopCategoryCombineService {
    @Autowired
    private IHeadLineService headLineService;
    @Autowired
    private IShopCategoryService shopCategoryService;
    
    @Override
    public Result<MainPageInfoDTO> getMainPageInfo() {
        //1.获取头条列表
        HeadLine headLineCondition = new HeadLine();
        headLineCondition.setEnableStatus(1);
        Result<List<HeadLine>> HeadLineResult = headLineService.queryHeadLine(headLineCondition, 1, 4);
        //2.获取店铺类别列表 首页展示的是根类别，新创建的条件查询对象parent=null
        ShopCategory shopCategoryCondition = new ShopCategory();
        Result<List<ShopCategory>> shopCategoryResult =
                shopCategoryService.queryShopCategory(shopCategoryCondition, 1, 100);
        //3.合并两者并返回
        Result<MainPageInfoDTO> result = mergeMainPageInfoResult(HeadLineResult, shopCategoryResult);
        return result;
    }

    private Result<MainPageInfoDTO> mergeMainPageInfoResult(Result<List<HeadLine>> headLineResult, Result<List<ShopCategory>> shopCategoryResult) {
        return  null;
    }

    public IHeadLineService getHeadLineService() {
        return headLineService;
    }

    public void setHeadLineService(IHeadLineService headLineService) {
        this.headLineService = headLineService;
    }

}
